pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let mid: Vec<&str> = num_str.split('(').collect();
    let number = mid[0];
    let base = mid[1].trim_end_matches(')');
    let from_base: u32 = base.parse().expect("Invalid base");

    let num = i64::from_str_radix(number, from_base).expect("Invalid number string");

    let mut result = String::new();
    let mut n = num;

    while n > 0 {
        let left = (n % to_base as i64) as u32;
        if to_base > 10 && left >= 10 {
            result.push((b'a' + (left - 10) as u8) as char);
        } else {
            result.push_str(&left.to_string());
        }
        n /= to_base as i64;
    }

    result.chars().rev().collect()
}
